

public class Main{

	// get trailing zero in n!
	public static long z(long n) {
		long count5 = 0;
		long div = 5;
		while (div <= n) {
			count5 += n / div;
			div *= 5;
		}
		return count5;
	}

	public static void main(String[] args) throws java.lang.Exception {
		java.io.BufferedReader r = new java.io.BufferedReader(
				new java.io.InputStreamReader(System.in));
		int number = Integer.parseInt(r.readLine());

		for (int i = 0; i < number; i++) {

			String s = r.readLine().trim();

			System.out.println(z(Long.parseLong(s)));
		}
	}
}
